define('controllers/common', function (require, exports, module) {
	"use strict";

	var fnGlobalUrl = require[require.toUrl ? 'toUrl' : 'resolve'];
	var $window = $(window),
		 $document = $(document);
		require('jquery.icheck');
  var VF = require('sp_validForm');
	/* ============================================================
	 * 前台页面基础类（basePage）
	 * ============================================================ */
	var m_basePage = window.basePage = {
		createNew: function () {
			var $internal = {};
			$internal.wW = parseInt($window.width());
			$internal.wH = parseInt($window.height());

			$internal.isAdvancedBrowser = (function () {
				return !$.lhave.browser.ie || ($.lhave.browser.ie && $.lhave.browser.version > 9);
			})();

			$internal.resizeScale = function () {
				if ($win.height() > 800 && $win.height() <= 1050) { //一般液晶显示器
					return 0;
				} else if ($win.height() > 1050) { //大屏幕显示器
					return 1;
				} else { //笔记本显示器
					return 2;
				}
			};

			return $internal;
		}
	};
	window.basePage = m_basePage;
	/* ============================================================
	 * 站点头部 举例
	 * ============================================================ */
	var m_siteHeader = new Class({
		initialize: function () {
			this._init();
		}
	});
	m_siteHeader.extend({
		_init: function () {
			this._initDom();
			var _this = this;
			_this.srchSel = $('#J_sel_placeholder');
			_this.srchOption = $('.J_sel_options');
			_this.optionSel = $('.J_sel_options ul li[data-option]');
		},
		_initDom: function () {},
		appear: function () {
			var _this = this,
					jud = 1;
			//搜索select选择
			_this.srchSel.click(function (event) {
				event.stopPropagation();
				_this.srchOption.show();
				jud = 0;
			});
			_this.optionSel.click(function (event) {
				event.stopPropagation();
				$('#J_type_value').val($(this).attr('data-value'));
				$('#J_type_text').text($(this).text());
				jud = 1;
				_this.srchOption.hide();
			});
			$('body').click(function(){
				if(!jud){
					jud = 1;
					_this.srchOption.hide();
				}
			});
			if($('.J_form').length>0){
				VF.formValid('.J_form');
			}

		}
	});
  var m_siterado = new Class({
		initialize: function () {
			this._init();
		}
	});
	m_siterado.extend({
		_init: function () {
			this._initDom();
	
		
		},
		_initDom: function () {},
		appear: function () {
			var _this = this;
			//  调用iCheck
			if($('.J_icheck').length>0){
				$('.J_form').find('.J_icheck').iCheck({
					checkboxClass: 'icheckbox_minimal',
					radioClass: 'iradio_minimal',
					increaseArea: '20%' // optional
				});
			}
		}
	});
	/* ============================================================
	 * 模块接口
	 * ============================================================ */
	module.exports = {
		run: function () {
			$.extend({
				siteHeader: new m_siteHeader(), //向jQuery 添加 siteHeader 举例
			  siteRado: new m_siterado()
			});
			$document.ready(function () {
				//		coding here ,  please delete the row
				$.siteHeader.appear(); //调用 appear();
				$.siteRado.appear(); //调用 appear();
			});
		}
	};

});
